<extend name="Public/base"/>

<block name="body">
    <!-- 标题 -->
    <div class="main-title">
        <h2>我的信息</h2>
    </div>
    <ul class="tab-nav nav">
        <volist name="info" id="group">
            <li data-tab="tab{$key}"
            <eq name="key" value="ucenter">class="current"</eq>
            ><a href="javascript:void(0);">{$key|get_member_key}</a></li>
        </volist>
    </ul>
    <div class="tab-content">

        <volist name="info" id="vo">

            <div id="tab{$key}" class="tab-pane <eq name="key" value="ucenter">in</eq> tab{$key}">
            <table class="table table-striped table-bordered">
                <thead>
                <tr>
                    <td width="20%">列项</td>
                    <td width="80%">值</td>
                </tr>
                </thead>
                <tbody>
                <foreach name="vo" key="k" item="item">
                    <tr>
                        <td width="20%">{$k|get_member_key}</td>
                        <switch name="k">
                            <case value="sex">
                                <td width="80%">
                                    <if condition="$item eq 1">男
                                        <elseif condition="$item eq 2"/>
                                        女
                                        <else/>
                                        未知
                                    </if>
                                </td>
                            </case>
                            <case value="uid">
                                <td width="80%">
                                    <span class="hidden" id="uid" data="{$item}">{$item}</span>
                                </td>
                            </case>
                            <case value="birthday">
                                <td width="80%">{$item|date="Y-m-d H:i:s",###}</td>
                            </case>
                            <case value="reg_time">
                                <td width="80%">{$item|date="Y-m-d H:i:s",###}</td>
                            </case>
                            <case value="reg_ip">
                                <td width="80%">
                                    <eq name="item" value="0">未知
                                        <else/>
                                        {$item}
                                    </eq>
                                </td>
                            </case>
                            <case value="last_login_ip">
                                <td width="80%">
                                    <eq name="item" value="0">未知
                                        <else/>
                                        {$item}
                                    </eq>
                                </td>
                            </case>
                            <case value="last_login_time">
                                <td width="80%">{$item|date="Y-m-d H:i:s",###}</td>
                            </case>
                            <case value="status">
                                <td width="80%">{$item|get_status_title}</td>
                            </case>
                            <case value="img">
                                <td width="80%">
                                    <eq name="item" value="0">还没有头像呢。
                                        <else/>
                                        <div class="headimg-pre-item"><img src="__ROOT__{$item|get_cover='path'}"/>
                                        </div>
                                    </eq>
                                </td>
                            </case>
                            <case value="headimgurl">
                                <td width="80%">

                                        <div class="headimg-pre-item"><img src="{$item}"/>
                                        </div>

                                </td>
                            </case>
                            <case value="weibo">
                                <td width="80%"><a href="http://www.weibo.com/{$item}" target="_blank">{$item}</a></td>
                            </case>
                            <default/>
                            <td>{$item}</td>
                        </switch>
                    </tr>
                </foreach>
                </tbody>
            </table>
    </div>

    </volist>


    </div>
    <div class="table">
        <a class="btn submit-btn" href="{:U('updateInfo')}">编辑资料</a>
        <a class="btn btn-return hidden" href="{:U('updateInfo',array())}">从微信导入</a>
    </div>
</block>

<!-- 加载底部JS -->
<block name="script">

    <script>
        function synchronous() {
            var ticket =$("#bindQrcode").attr('data');
            $.post("{:U('bind')}",
                    {
                        ticket:ticket
                    },
                    function(data){
                        $("#bindStatus").text(data.info);
                    });
        }

        $("#bindQrcode").click(function(){
            var uid =$("#uid").attr('data');
            $.post("{:U('bind')}",
                    {
                        bind:true,
                        uid:uid
                    },
                    function(data){
                        if(data.status == 1){
                            $("#bindQrcode").attr('data',data.info.ticket).hide();
                            $("#bindStatus").text(data.info.tips);
                            $("#qrcodeImage").attr('src',data.info.qrcode).show();
                        }else{
                            $("#bindStatus").text(data.info);
                        }
                    }
            );
            window.setInterval("synchronous()", 10000);
        });

    </script>

    <include file="Public/footjs"/>
</block>